package org.brisling.domain.sysman;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;

import org.brisling.domain.common.BaseUplinkDomain;
import org.brisling.domain.sysman.inf.ListByDeptDataModeler;




@Entity(name="users")
public class Users extends BaseUplinkDomain<Department> implements ListByDeptDataModeler<Department>{
	
	
	
	
	
	@Transient
	private Department dept;
	
	@Transient
	private String deptName;
	
	
	@Column(name="uplinkid",insertable=false,updatable=false)
	private Long deptid;
	
	
	
	@Column
	private String password;
	
	
	@Column
	private String password_salt;
	
	/*
	 * 登录名称
	 */
	@Column(name="loginname")
	private String loginName;
	
	/*
	 * 用户代码
	 */
	@Column
	private String userCode;	
	
	
	
	/*
	 * 工作电话
	 */
	@Column
	private Integer workphone;
	
	/*
	 * 移动电话
	 */
	@Column
	private Integer mobile;	
	
	
	/*
	 * 账号过期标志
	 */
	@Column
	private Boolean accountNonExpired;
	
	/*
	 * 账号锁定标志
	 */
	@Column
	private Boolean accountNonLocked ;
	
	/*
	 * 信任状态标志
	 */
	@Column
	private Boolean credentialsNonExpired ;
	
	/*
	 * 启用状态
	 */
	@Column
	private Boolean enabled ;
	
	
	@Column
	private String email;
	
	/*
	 * user second dept
	 */
	@Transient
	
	private Department secondDept;
	

	/*
	 * all Department that current user must serviced for it 
	 */
	@Transient	
	private List<Department> managedDept;
	
	
	
	
	/*
	 * current user managed roles
	 */
	@Transient
	private List<Roles> relationRoles;
	
	
	
	
	@Transient
	private List<Permissions> relationPermissions;
	
	//get the project special ui and other setting from config file
	//@Transient
	//private AppCustomConfig customConfig;
	
	
	public Users(){
		super(Department.class);
	}
	
	

	
	public Department getDept() {
		return super.getUplink();
	}

	
	public void setDept(Department dept) {
		super.setUplink(dept);
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getLoginName() {
		return loginName==null?"":loginName;
	}

	public void setLoginname(String loginName) {
		this.loginName = loginName;
	}

	public String getUserCode() {
		return userCode==null?"":userCode;
	}

	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}

	

	public Integer getWorkphone() {
		return workphone;
	}

	public void setWorkphone(Integer workphone) {
		this.workphone = workphone;
	}

	public Integer getMobile() {
		return mobile;
	}

	public void setMobile(Integer mobile) {
		this.mobile = mobile;
	}

	

	
	public void setAccountNonExpired(Boolean accountNonExpired) {
		this.accountNonExpired = accountNonExpired;
	}

	

	public void setAccountNonLocked(Boolean accountNonLocked) {
		this.accountNonLocked = accountNonLocked;
	}

	

	public void setCredentialsNonExpired(Boolean credentialsNonExpired) {
		this.credentialsNonExpired = credentialsNonExpired;
	}

	

	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}

	public Department getSecondDept() {
		return secondDept;
	}

	public void setSecondDept(Department secondDept) {
		this.secondDept = secondDept;
	}

	public List<Department> getManagedDept() {
		return managedDept;
	}

	public void setManagedDept(List<Department> managedDept) {
		this.managedDept = managedDept;
	}

	public Long getDeptid() {
		return super.getUplinkid();
	}

	public void setDeptid(Long deptid) {
		 super.setUplinkid(deptid);
	}

	public Boolean getAccountNonExpired() {
		return accountNonExpired;
	}

	public Boolean getAccountNonLocked() {
		return accountNonLocked;
	}

	public Boolean getCredentialsNonExpired() {
		return credentialsNonExpired;
	}

	public Boolean getEnabled() {
		return enabled;
	}	

	public String getDeptName() {
		return super.getUplinkName();		
	}

	public void setDeptName(String deptName) {
		super.setUplinkName(deptName);
	}

	
	@Override
	public Department getUplink() {
		// TODO Auto-generated method stub
		return this.dept;
	}

	@Override
	public void setUplink(Department t) {
		// TODO Auto-generated method stub
		this.dept = t;
	}
	
	
	
	
	




	
	public String getUsername() {
		// TODO Auto-generated method stub
		return this.name;
	}




	
	public boolean isAccountNonExpired() {
		// TODO Auto-generated method stub
		return this.accountNonExpired;
	}




	
	public boolean isAccountNonLocked() {
		// TODO Auto-generated method stub
		return this.accountNonLocked;
	}




	
	public boolean isCredentialsNonExpired() {
		// TODO Auto-generated method stub
		return this.credentialsNonExpired;
	}




	
	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return this.enabled;
	}




	
	public void eraseCredentials() {
		// TODO Auto-generated method stub
		this.password = null;
	}




	public List<Roles> getRelationRoles() {
		return relationRoles;
	}




	public void setRelationRoles(List<Roles> relationRoles) {
		this.relationRoles = relationRoles;
	}


	public List<Permissions> getRelationPermissions() {
		return relationPermissions;
	}




	public void setRelationPermissions(List<Permissions> relationPermission) {
		this.relationPermissions = relationPermission;		
	}




	public String getPassword_salt() {
		return password_salt;
	}




	public void setPassword_salt(String password_salt) {
		this.password_salt = password_salt;
	}




	public String getEmail() {
		return email;
	}




	public void setEmail(String email) {
		this.email = email;
	}

	
	
	
	
	

}
